// Copy constructor

#include <iostream>
using namespace std;


class Human {
	public:
		// Constructor
		Human( int age=0, const char* name="wuming" ) {
			cout << "This function has been called" << endl;
			this->age = age;
			this->name = name;
		}
		// Copy constructor
		// If you provide a copy constructor, you must to manipulate the variables yourself.
		Human( const Human& that ) {
			// [ int age ]
			// [ string name ]
			this->age = that.age;
			this->name = that.name;
		}
		void getinfo( ) {
			cout << "name : " << name << endl;
			cout << "age : " << age << endl;
		}
	private:
		int age;
		string name;
};

// designer
// ------------------------------------------------------------------
// user

int main( void ) { 
	Human h( 22, "zhangfei" );
	h.getinfo( );

	Human h3 = h;
	h3.getinfo( );

	return 0;
}

